<%@taglib uri="http://www.zkoss.org/jsp/zul"  prefix="zk"%>
 <zk:page zscriptLanguage="java">
        <zk:vbox>
            <zk:grid width="400px">
                <zk:columns>
                    <zk:column label="category" width="150px" />
                    <zk:column label="value" />
                </zk:columns>
                <zk:rows>
                    <zk:row>
                        <zk:label id="c0" value="C/C++" />
                        <zk:decimalbox id="v0" value="21.2" constraint="no empty"
                                       onChange="update(0)" />
                    </zk:row>
                    <zk:row>
                        <zk:label id="c1" value="VB" />
                        <zk:decimalbox id="v1" value="10.2" constraint="no empty"
                                       onChange="update(1)" />
                    </zk:row>
                    <zk:row>
                        <zk:label id="c2" value="Java" />
                        <zk:decimalbox id="v2" value="40.4" constraint="no empty"
                                       onChange="update(2)" />
                    </zk:row>
                    <zk:row>
                        <zk:label id="c3" value="PHP" />
                        <zk:decimalbox id="v3" value="28.2" constraint="no empty"
                                       onChange="update(3)" />
                    </zk:row>
                </zk:rows>
            </zk:grid>
            <zk:checkbox label="3D Chart" checked="true"
                         onCheck="mychart.setThreeD(self.isChecked())" />

            <zk:chart id="mychart" title="Pie Chart Demo" width="500" height="250"
                      type="pie" threeD="true" fgAlpha="128">
                <zk:attribute name="onClick">
			  String areaid = event.getArea();
			  if (areaid != null) {
			    Area area = self.getFellow(areaid);
			    alert(""+area.getAttribute("entity")+": "+area.getTooltiptext());
			  }
                </zk:attribute>
                <zk:zscript>
			void update(int rowIndex) {
				Label lb = (Label) self.getFellow("c"+rowIndex);
				Decimalbox db = (Decimalbox) self.getFellow("v"+rowIndex);
				model.setValue(lb.value, new Double(db.getValue().doubleValue()));
		  	}
		  	PieModel model = new SimplePieModel();
			for(int j=0; j<4; ++j) {
				update(j);
		  	}
		  	mychart.setModel(model);
                </zk:zscript>
            </zk:chart>

        </zk:vbox>
    </zk:page>